Release 10.1A: OpenEdge Development:
Progress Dynamics Advanced Development
Functions that return field values and attributes
The
Queryclass that supports SDOs provides a large number of functions that you can use to retrieve data values and the properties of those fields.column<attribute> functions
There is a whole set of functions that return individual 4GL attributes from fields in a data object (one for which the
QueryObjectproperty isTRUE, basically SDOs or SBOs).These functions are located in an adjunct SDO super procedure called
dataextcols.p. Both thequeryclass and thedataclass have enough supporting functions that the code to support them causes compilation problems in older versions of the Progress 4GL. So thegetandsetfunctions for properties are in separate super procedures calledqueryext.panddataext.p,respectively. In addition, thedataextcols.pprocedure supports all these special column attribute functions. These are all run along with the standard super proceduresquery.panddata.pand made part of the super procedure stack.These functions return values in the appropriate data type for the attribute. All the functions have names of column plus the attribute name. The prefix, column, is not entirely appropriate here, because these return field values from the current row in the SDO buffer, not browse column values.
They take a single input parameter, which is the name of the field. This can be:
Column attribute functions include:
columnColumnLabel— Returns theColumn-Labelof the field. Note the word column does appear twice in the function name.columnDataType— Returns the data type of the underlying database field represented by this column.columnDBColumn— Returns the name of the column in the database, in case it has been renamed in the SDO.columnDBName— Returns the name of the database that the field is derived from.columnHandle— Returns the handle of the field in theRowObjectbuffer.columnHelp— Returns the value of the field’s Help text.columnInitial— Returns the field’s initial value.columnLabel— Returns the field’s label.columnModified— Returns aLOGICALflag indicating whether the field has been modified since it was read into theRowObjecttable.columnPrivateData— Returns the ProgressPrivate-Dataattribute of a specified column.columnTable— Returns the name of the database table the column is derived from. It is qualified according to how the SDO is defined.columnWidth— Returns the width in characters.There are also equivalent
assignColumn<attribute>functions for most of these, which take the field name and the attribute value as input parameters.There are also a few more specialized column functions that are useful.
columnQuerySelection
This
CHARACTERfunction, supported for data objects, takes a column name as input and returns aCHR(1)-delimited string with all operators and values that have been added to the query for this field using theassignQuerySelectionmethod (described later in this chapter). For example, if the query containscustnum>5andcustnum<9, this function returns>|5|<|9(whereCHR(1)is shown as |). Use this function to do analysis on the current query or to display information to the user.columnValue
This
CHARACTERfunction, supported for data objects, takes the name of the field as input and returns its value, in character form, but without any formatting characters added. This is equivalent to applying theSTRINGfunction to theBUFFER-VALUEof the field.columnStringValue
This
CHARACTERfunction, supported for data objects, takes the name of the field as input and returns itsSTRING-VALUE, which is the fully formatted value as it would appear on the screen (so it is the buffer equivalent to theSCREEN-VALUEof a displayed field or browse column).colValues
This
CHARACTERfunction, supported for data objects, takes as input a comma-separated list of field names in an SDO and returns aCHR(1)-delimited list of the formatted values (STRING-VALUEs, in effect) for those columns for the current row, preceded by a string called theRowIdentthat holds the databaseRowIDof the record the columns are derived from. If the SDO involves a join, then this firstRowIdententry in the list is itself a comma-separated list of theRowIDvalues for the records in the join. This is the standard function used internally by viewers in particular to retrieve the values to display as theSCREEN-VALUEs of the fields in the viewer.Note that because the
RowIdentis always the first entry in theCHR(1)-delimited list, your code must always look for the value for a column that was in the nth position in the input list, in then+1th position in the return value.This function can be useful for retrieving multiple values at a time, but the
columnValueandcolumnStringValuefunctions were designed for application use as a more convenient way to retrieve individual values at a time.colStringValues
This
CHARACTERfunction provides an alternative tocolValuesas a way to retrieve multiple values in a single call, and with flexible formatting. It does not return theRowIdentof the database records ascolValuesdoes. The function takes threeINPUTparameters:
|
Copyright © 2005 Progress Software Corporation www.progress.com Voice: (781) 280-4000 Fax: (781) 280-4095 |